

'''
    需求:关联数据替换到请求数据中

'''



import  requests
import hashlib
import pickle
import re
import time
from server_info import register,login,create
from Util import *





#testcase_path= 'data.txt'
#log_path= 'log.log'

count=1
for line in get_testcase_data(test_data_path):
    print(8, count, line)
    if count==4:break
    line= pre_handle_data(line)
    #print(1,line)
    print(9, count, line)
    url,test_data,http_method,assert_word,correlate_exp= line.split('||')
    url=eval(url)
    print(1,url,test_data,http_method,assert_word)
    start_time= time.time()
    req= send_request(url,test_data,http_method)
    end_time= time.time()
    #print(9,req,req.text)
    post_handle_data(correlate_exp,req.text)
    print(global_data)
    elapse_time= round(end_time-start_time)
    result= assert_result(req.text,assert_word)
    #count+=1
    #if count==2:breakr
    count += 1
    write_log(log_path,url,http_method,test_data,req.text,elapse_time,result,assert_word)
